package com.sanji.pay.pay.repository;

import com.sanji.pay.pay.entity.PayOrder;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;
import java.util.List;

/**
 * Created by cbh on 2017/8/28.
 */
public interface PayOrderRepository extends JpaRepository<PayOrder,Integer> {

  PayOrder findByPayNum(String payNumber);

  PayOrder findByOrderNum(String orderNum);

  PayOrder findByOrderNumAndSourceType(String orderNum, String sourceType);

  Page<PayOrder> findAll(Specification<PayOrder> spec, Pageable pageable);
  
  List<PayOrder> findByCusIdAndCreateTimeBetween(String sourceType, Date startTime, Date endTime);
}
